//import 'package:flutter/material.dart';
//import 'package:flutter_appehs/app/login/login_view.dart';
//import 'package:flutter_appehs/app/root_scene.dart';
//import 'package:flutter_appehs/common/sq_color.dart';
//import 'package:flutter_appehs/common/utils/UserInfoUtils.dart';
//import 'package:flutter_appehs/common/utils/sp_util.dart';
//import 'package:flutter_test/flutter_test.dart';
//import 'package:matcher/matcher.dart';
//import 'package:test_api/test_api.dart';
//
//
//final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
//
//class AppScene extends StatelessWidget {
// @override
//  void initState() {
import 'package:flutter/material.dart';
import 'package:flutter_ahj_app/app/appscene/AppSceneViewModel.dart';
import 'package:flutter_ahj_app/app/companyInfo/view/CompanyInfoView.dart';
import 'package:flutter_ahj_app/app/companyInfo/viewModel/CompanyInfoViewModel.dart';
import 'package:flutter_ahj_app/app/feedback/view/feedbackView.dart';
import 'package:flutter_ahj_app/app/feedback/viewModel/feedbackViewModel.dart';
import 'package:flutter_ahj_app/app/login/view/login_view.dart';
import 'package:flutter_ahj_app/app/NewLogin/LoginViewModel.dart';
import 'package:flutter_ahj_app/app/my/view/feedSubPage.dart';
import 'package:flutter_ahj_app/app/my/view/feedbackPage.dart';
import 'package:flutter_ahj_app/app/regist/view/RegistViewPage.dart';
import 'package:flutter_ahj_app/app/regist/viewmodel/RegistViewModel.dart';
import 'package:flutter_ahj_app/base/basewidget/view/BaseWidget.dart';
import 'package:flutter_ahj_app/base/basewidget/viewmodel/ViewModelProvider.dart';
import 'package:flutter_ahj_app/base/cunchu/UserInfoUtils.dart';
import 'package:flutter_ahj_app/root_scene.dart';

import '../androidUpdata/view/UpdataView.dart';
import '../androidUpdata/viewModel/UpdataViewModel.dart';
import '../../base/values/SQColor.dart';


final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();

class AppScene extends BaseStatefulWidget {

  @override
  State<StatefulWidget> initState() {
    // TODO: implement initState
    return AppSceneState();
  }
}

class AppSceneState extends BaseState<AppSceneViewModel, AppScene> {


  bool isInitModule = false;

  @override
  initState() {
    super.initState();

    UserInfoUtils.getInstance().then((b) {
      setState(() {
        UserInfoUtils.getUserToken() == ''
            ? body = ViewModelProvider(
          viewModel: LoginViewModel(),
          child: LogInPage1(),
        )
            : body = RootScene();
      });
    });
  }

  List<Locale> an = [
    const Locale('zh', 'CH'),
    const Locale('en', 'US'),
  ];
  List<Locale> ios = [
    const Locale('en', 'US'),
    const Locale('zh', 'CH'),
  ];
  Widget body=new Container();
  @override
  Widget initWidget() {
    // TODO: implement initWidget
    return MaterialApp(
      routes:  {
        "/login": (context) => ViewModelProvider(viewModel: LoginViewModel(), child: LogInPage1(),),//登录页面
        "/home": (context) => RootScene(),//首页
        "/regist": (context) => ViewModelProvider(viewModel: RegistViewModel(), child: RegistViewPage(),),//用户注册页面
        "/FeedbackPage": (context) => FeedbackPage(),
        "/FeedSubPage": (context) => FeedSubPage(),


        "/updata": (context) => ViewModelProvider(viewModel: UpdataViewModel(), child: UpdataView(),),

        ///项目管理

        /// 关于我们 CompanyInfoView

        "/CompanyInfoView": (context) => ViewModelProvider(viewModel: CompanyInfoViewModel(), child: CompanyInfoView(),),

        ///反馈
        "/FeedbackView": (context) => ViewModelProvider(viewModel: FeedbackViewModel(), child: FeedbackView(),),

      } ,
      title: '青柠',
      supportedLocales: [
        const Locale('zh', 'CH'),
      ],
      theme: ThemeData(
        primaryColor: SQColor.theme_color,
        dividerColor: Color(0xffeeeeee),
        scaffoldBackgroundColor: SQColor.white,
        textSelectionColor: SQColor.white,
        textTheme: TextTheme(bodyText1: TextStyle(color: SQColor.black)),
      ),
      home: RootScene(),
      
    );
  }

}
